package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.system.domain.SupplierManagement;
import com.ruoyi.system.mapper.SupplierManagementMapper;
import com.ruoyi.system.service.ISupplierManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 供应商信息管理Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-19
 */
@Service
public class SupplierManagementServiceImpl implements ISupplierManagementService {
    @Autowired
    private SupplierManagementMapper supplierManagementMapper;

    /**
     * 查询供应商信息管理
     *
     * @param supplierId 供应商信息管理主键
     * @return 供应商信息管理
     */
    @Override
    public SupplierManagement selectSupplierManagementBySupplierId(String supplierId) {
        return supplierManagementMapper.selectSupplierManagementBySupplierId(supplierId);
    }

    /**
     * 查询供应商信息管理列表
     *
     * @param supplierManagement 供应商信息管理
     * @return 供应商信息管理
     */
    @Override
    public List<SupplierManagement> selectSupplierManagementList(SupplierManagement supplierManagement) {
        return supplierManagementMapper.selectSupplierManagementList(supplierManagement);
    }

    /**
     * 新增供应商信息管理
     *
     * @param supplierManagement 供应商信息管理
     * @return 结果
     */
    @Override
    public int insertSupplierManagement(SupplierManagement supplierManagement) {
        supplierManagement.setCreateTime(DateUtils.getNowDate());
        supplierManagement.setSupplierId(IdUtils.fastSimpleUUID());
        return supplierManagementMapper.insertSupplierManagement(supplierManagement);
    }

    /**
     * 修改供应商信息管理
     *
     * @param supplierManagement 供应商信息管理
     * @return 结果
     */
    @Override
    public int updateSupplierManagement(SupplierManagement supplierManagement) {
        supplierManagement.setUpdateTime(DateUtils.getNowDate());
        return supplierManagementMapper.updateSupplierManagement(supplierManagement);
    }

    /**
     * 批量删除供应商信息管理
     *
     * @param supplierIds 需要删除的供应商信息管理主键
     * @return 结果
     */
    @Override
    public int deleteSupplierManagementBySupplierIds(String[] supplierIds) {
        return supplierManagementMapper.deleteSupplierManagementBySupplierIds(supplierIds);
    }

    /**
     * 删除供应商信息管理信息
     *
     * @param supplierId 供应商信息管理主键
     * @return 结果
     */
    @Override
    public int deleteSupplierManagementBySupplierId(String supplierId) {
        return supplierManagementMapper.deleteSupplierManagementBySupplierId(supplierId);
    }
}
